/**
 * 个性化设置
 */
const usersetting = {
  state: {
    setting: {
      theme: 'white',                // 导航栏主题
      uniqueOpened: true,       // 是否开启手风琴模式
      menuButton: true,         // 是否显示菜单展开按钮
      showCrumbs: true,         // 是否显示全局面包屑
      themeModel: 'auto',           // 主题模式
      showAvatar: true            // 是否显示头像
    }
  },
  
  getters: {
    setting: (state) => state.setting
  },
  
  mutations: {
    // 设置主题
    setUpTheme(state, theme) {
      // console.log('setUpTheme（切换导航栏主题方法已被调用）已被调用');
      state.setting.theme = theme
    },
    // 设置菜单是否为手风琴模式
    setLeftMenuUniqueOpened(state, e) {
      state.setting.uniqueOpened = e.show
      // console.log('setLeftMenuUniqueOpened（切换手风琴模式方法被调用）已被调用');
    },
    // 显示侧边栏折叠按钮
    setLeftMenuButton(state, e) {
      state.setting.menuButton = e.show
    },
    // 是否显示面包屑导航
    setLeftMenuCrumbs(state, e) {
      state.setting.showCrumbs = e.show
    },
    // 主题模式
    setThemeModel(state, themeModel) {
      // console.log('setThemeModel（切换主题模式方法被调用）已被调用');
      state.setting.themeModel = themeModel
    },
    // 是否显示用户头像
    setshowAvatar(state,e) {
      state.setting.showAvatar = e.show
    }
  },
  
  actions: {
    initState ({commit }) {
      commit('initState')
    },
    setUpTheme ({commit}, e) {
      commit('setUpTheme', e)
    },
    setLeftMenuUniqueOpened({commit}, e) {
      commit('setLeftMenuUniqueOpened', e)
    },
    setLeftMenuButton({commit}, e) {
      commit('setLeftMenuButton', e)
    },
    setLeftMenuCrumbs({commit}, e) {
      commit('setLeftMenuCrumbs', e)
    },
    setThemeModel({commit}, e) {
      commit('setThemeModel', e)
    },
    setshowAvatar({commit}, e) {
      commit('setshowAvatar', e)
    }
  }
}


export default usersetting